<template>
  <!-- <div>首页</div> -->
  <div>
    <!-- <TopWrap></TopWrap> -->

    <!-- 页面滚动到一定程度显示该固定的搜索框 -->
    <!-- <div class="fixed-search">
      <div class="search-box w">
        <div class="logo1">
          <a href="#">二手书吧</a>
        </div>
        <div class="search">
          <input type="text" placeholder="请输入书名" class="input2" />
          <div class="search-icon1"></div>
        </div>
      </div>
    </div> -->

    <!-- 选择区域，中部 -->
    <div class="selector">
      <!-- 我是选择区域 -->
      <div class="selector-header w">
        <div class="selector-switch" @click='select'>
          <router-link to='/find/recommend' class="switch">推荐</router-link>
          <router-link to='/find/sort' class="no_switch">分类</router-link>
        </div>
      </div>
    </div>
    <!-- 书本商品的区域 -->
    <div class="main w">
      <!-- 路由推荐区域和分类区域 -->
        <router-view></router-view>
    </div>

    </div>
</template>

<script>
// import TopWrap from '@/components/TopWrap'
export default {
  name: 'FineIndex',
  data () {
    return {
      sw: true
    }
  },
  methods: {
    select (event) {
      // console.log(event.currentTarget)
      if (event.target.innerText === '推荐') {
        event.currentTarget.firstElementChild.className = 'switch'
        event.currentTarget.lastElementChild.className = 'no_switch'
      } else if (event.target.innerText === '分类') {
        event.currentTarget.lastElementChild.className = 'switch'
        event.currentTarget.firstElementChild.className = 'no_switch'
      }
      // console.log(event.currentTarget.parentElement)
    }
  }
}
</script>

<style scoped>
/* 固定搜索框 */
/* .fixed-search {
  display: none;
  position: fixed;
  top: 0px;
  left: 50%;
  margin-left: -50%;
  width: 100%;
  height: 60px;
  opacity: 0;
  background-color: #f1f3f5;
  transition: all 1s;
  z-index: 100;
}

.search-box .logo1 {
  position: absolute;
  top: 0;
  left: 80px;
  font-size: 20px;
  font-weight: 700;
  line-height: 60px;
  cursor: pointer;
}

.search .input2 {
  float: left;
  cursor: auto;
  width: 500px;
  height: 50px;
  border: none;
  font-size: 15px;
  color: #6d757a;
  line-height: 14px;
  padding-left: 25px;
  margin-top: 0px;
  background: #fff;
  border-radius: 25px;
}

.search .search-icon1 {
  float: left;
  width: 25px;
  height: 25px;
  margin: 45px 0px 0px -45px;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  cursor: pointer;
  transform: translateY(-120%);
  background-image: url(../images/搜索.png);
} */
/* 首页选择区域 */
.selector {
  height: 100px;
  background-color: #f5f5f5;
}
.selector-header {
  position: relative;
  margin: 0 auto;
  height: 100px;
  background-color: #f5f5f5;
  /* background-color: white; */
}

.selector-switch {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 240px;
  height: 60px;
  margin-top: -30px;
  margin-left: -120px;
  /* background-color: #636c7b; */
  background-image: url(@/assets/images/switch_bg.png);
  background-size: 100% 100%;
}

.selector-switch a {
  text-decoration: none;
}

.switch {
  float: left;
  width: 120px;
  height: 56px;
  color: #212121;
  font-size: 20px;
  /* font-weight: PingFang SC; */
  line-height: 56px;
  text-align: center;
  font-weight: 700;
  background: url(@/assets/images/switch.png);
  background-size: 100% 100%;
  cursor: pointer;
}

.no_switch {
  float: left;
  /* margin-left: 10px; */
  width: 120px;
  height: 56px;
  font-size: 20px;
  line-height: 56px;
  text-align: center;
  color: #bcbcbc;
  font-weight: 400;
  /* background: url(../images/switch_right.png); */
  background-size: 100% 100%;
  cursor: pointer;
}
/* 首页主要区域 */
.main {
  width: 100%;
  height: 100%;
  background-color: #f5f5f5;
  /* background-color: #fff; */
}

/* .main2 {
    background-color: #f2f1ea;
    background-color: #fff;
} */

</style>
